"""
LESSON. Modul
"""
from datetime import date, datetime, timedelta
import locale

date
today = date.today()
print(today)            # 2022-07-27
print(today.day)        # 27
print(today.month)      # 7
print(today.year)       # 2022
print(today.weekday())  # 2019

datetime
now = datetime.now()
now2 = datetime.today()

print(now)              # 2022-07-27 14:16:51.696373
print(now.day)          # 27
print(now.month)        # 7
print(now.year)         # 2019
print(now.weekday())    # 2
print(now.hour)         # 14
print(now.minute)       # 16
print(now.second)       # 51

days = ['пн.du', 'вт,se', 'ср.cho', 'чт.pa', 'пт.ju', 'сб.sha', 'вс.ya']
print(days[now.weekday()])                # ср

# clocale.setlocale(locale.LC_ALL, 'ru_RU.UTF-8')
# locale.setlocale(locale.LC_ALL, 'ru_RU')

now = datetime.now()
print(now)                 # 2022-07-27 12:00:51.176183
#
print(now.strftime('%a'))  # Wed
print(now.strftime('%A'))  # Wednesday
#
print(f'Дата-sana: {now.strftime("%A, %d %b %Y")}') # data: Wednesday, 27 jul 2022
print(f'Время-vaqt: {now.strftime("%H:%M:%S")}')    # vremya: 12:05:13
#
print(now.strftime('%c'))      # Wed Jul 27 12:05:58 2022
print(now.strftime('%x'))      # 07/27/22
print(now.strftime('%X'))      # 12:07:27

now = datetime.today()
print(now.strftime('%c'))      # Wed Jul 27 12:08:07 2022
d1 = now + timedelta(days=1, hours=2, minutes=10)
print(d1.strftime('%c'))       # Sat Jul 28 12:18:56 2022
d2 = now - timedelta(days=1, hours=2, minutes=10)
print(d2.strftime('%c'))       #     jul 26 10:

import random  # "import random" yozsak ham boladi.
#
x = random.randint(1, 100)
user_num = 0
cnt = 0

while True:
    user_num = int(input('Я загадал число от 1 до 100 - угадай его: '))
    cnt += 1
    if user_num == x:
        print(f'Ты угадал число за {cnt} попыток, Sonni topdingiz! Urunishlar soni')
        print("""
                -------------
                |           |
               @|  0     0  |@
                |     ^     |
                |  .     .  |
                |   `...`   |
       __       -------------       __
       \ \          |   |          / /        Og'abek
        \ \_________|   |_________/ /         Jo'ra kel
         \ |   |             |   | /          o'ynaymiz
          \|   |             |   |/
           |___|             |___|
            _|_               _|_
            | |               | |
            O O               O O
                """)
        if input('Сыграем еще?, Yana o\'naymizmi? "Yoq|HA":') == 'Ha':
            x = random.randint(1, 100)
            cnt = 0
        else:
            print('Спасибо за игру, Tashakkur!')
            break
    elif user_num > x:
        print('Мое число меньше, mening raqamim __ dan kam')
    else:
        print('Мое число больше, mening raqamim __ dan katta')
